<?php

namespace Tuobaye\FilamentAdmin\Commands;

use Illuminate\Console\Command;

class FilamentAdminInstall extends Command
{
    protected $signature = 'filament-admin:install';
    protected $description = '安装filament-admin';

    public function handle(): int
    {
        $this->components->info('Installing Filament Admin ... 🐞');
        $this->call('vendor:publish', [
            '--tag' => 'filament-admin-config',
        ]);

        $this->call('vendor:publish', [
            '--tag' => 'filament-admin-migrations',
        ]);

        $this->call('migrate');


        if ($this->confirm('是否立即创建一个新的管理员账号', true)) {
            $this->call('generate:admin');
        };
        return self::SUCCESS;

    }

}
